﻿using FluentNHibernate.Mapping;
using SimpleScrum.Core.Entities;

namespace SimpleScrum.Core.Mappings
{
    public class UserStoryMap : ClassMap<UserStory>
    {
        public UserStoryMap()
        {
            Table("UserStory");
            LazyLoad();
            Id(x => x.Id).Column("ID").GeneratedBy.GuidComb();
            Map(x => x.Title).Column("Title").Not.Nullable();
            Map(x => x.Details).Column("Details").Not.Nullable();
            Map(x => x.WorkHour).Column("WorkHour").Not.Nullable();
            Map(x => x.Points).Column("Points").Not.Nullable();
            Map(x => x.Priority).Column("Priority").Not.Nullable();
            Map(x => x.AssignTo).Column("AssignTo").Not.Nullable();
            Map(x => x.AssignDate).Column("AssignDate").Not.Nullable();
            Map(x => x.CreatedBy).Column("CreatedBy").Not.Nullable();
            Map(x => x.CreatedDate).Column("CreatedDate").Not.Nullable();
            References(x => x.Project).Column("ProjectID").Cascade.All();
            Map(x => x.Status).Column("StatusID").Not.Nullable();
            Map(x => x.LastUpdate).Column("LastUpdate").Not.Nullable();
        }
    }
}